<!DOCTYPE html>
<html dir="ltr">

<head>
  <meta charset="UTF-8">
  <title>Loading</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <link href="../../../../../css/ionic.bundle.css" rel="stylesheet">
  <link href="../../../../../scripts/testing/styles.css" rel="stylesheet">
  <script src="../../../../../scripts/testing/scripts.js"></script>
  <script src="../../../../../dist/ionic.js"></script>
</head>

<body>
  <ion-app>

      <ion-header translucent>
        <ion-toolbar>
          <ion-title>Loading</ion-title>
        </ion-toolbar>
      </ion-header>

      <ion-content padding fullscreen>
        <ion-button id="basic" expand="block" onclick="presentLoading()">Show Loading</ion-button>
        <ion-button id="default" expand="block" onclick="presentLoadingWithOptions({duration: 2000, content: 'Please wait...'})">Show Default Loading</ion-button>
        <ion-button expand="block" onclick="presentLoadingWithOptions({duration: 2000, content: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ea voluptatibus quibusdam eum nihil optio, ullam accusamus magni, nobis suscipit reprehenderit, sequi quam amet impedit. Accusamus dolorem voluptates laborum dolor obcaecati.'})">Show Loading with long content</ion-button>
        <ion-button expand="block" onclick="presentLoadingWithOptions({duration: 2000, content: 'Please wait...', spinner: null})">Show Loading with no spinner</ion-button>
        <ion-button expand="block" onclick="presentLoadingWithOptions({duration: 5000, content: 'Please wait...', translucent: true})">Show Loading with translucent</ion-button>
        <ion-button expand="block" onclick="presentLoadingWithOptions({duration: 5000, content: 'Please wait...', translucent: true, cssClass: 'custom-class custom-loading'})">Show Loading with cssClass</ion-button>
        <ion-button expand="block" onclick="presentLoadingWithOptions({backdropDismiss: true})">Show Backdrop Click Loading</ion-button>

        <ion-loading-controller></ion-loading-controller>

        <ion-grid>
          <ion-row>
            <ion-col size="6">
              <f class="red"></f>
            </ion-col>
            <ion-col size="6">
              <f class="green"></f>
            </ion-col>
            <ion-col size="6">
              <f class="blue"></f>
            </ion-col>
            <ion-col size="6">
              <f class="yellow"></f>
            </ion-col>
            <ion-col size="6">
              <f class="pink"></f>
            </ion-col>
            <ion-col size="6">
              <f class="purple"></f>
            </ion-col>
            <ion-col size="6">
              <f class="black"></f>
            </ion-col>
            <ion-col size="6">
              <f class="orange"></f>
            </ion-col>
          </ion-row>
        </ion-grid>
      </ion-content>

  </ion-app>
  <script>
    async function presentLoading() {
      const loadingController = document.querySelector('ion-loading-controller');
      await loadingController.componentOnReady();
      const loadingElement = await loadingController.create({
        message: 'Hellooo',
        duration: 2000
      });
      return await loadingElement.present();
    }

    async function presentLoadingWithOptions(opts) {
      const loadingController = document.querySelector('ion-loading-controller');
      await loadingController.componentOnReady();
      const loadingElement = await loadingController.create(opts);
      return await loadingElement.present();
    }
  </script>

  <style>
    ion-toolbar {
      --background: white;
    }

    .custom-loading .loading-wrapper {
      background: rgb(155, 221, 226);
    }

    f {
      display: block;
      background: blue;

      width: 100%;
      height: 200px;
      margin: 20px auto;
    }

    .red {
      background-color: #ea445a;
    }

    .green {
      background-color: #76d672;
    }

    .blue {
      background-color: #3478f6;
    }

    .yellow {
      background-color: #ffff80;
    }

    .pink {
      background-color: #ff6b86;
    }

    .purple {
      background-color: #7e34f6;
    }

    .black {
      background-color: #000;
    }

    .orange {
      background-color: #f69234;
    }

  </style>
</body>

</html>
